package main;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * status bar that will appear under the map
 * displays turn count, player side, other useful info
 * @author 12817152
 *
 */
public class MapStatusBar extends JPanel {
	TurnManager t;
	JLabel pName;
	JLabel turns;
	JButton turn = new JButton("Start Game");
	boolean resume = false;

	/**
	 * constructor
	 * @param turnMgr - turn manager
	 */
	public MapStatusBar(TurnManager turnMgr) {
		t = turnMgr;
		setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));

		pName = new JLabel("Player: " +t.active.getName());
		turns = new JLabel("Turn " +t.getTurn());

		this.add(pName);
		this.add(Box.createHorizontalGlue());
		this.add(turns);
		this.add(Box.createHorizontalGlue());
		this.add(turn);
	}

	/**
	 * updates information when needed
	 */
	public void update() {
		this.removeAll();
		pName = new JLabel("Player: " +t.active.getName());
		turns = new JLabel("Turn: " +t.getTurn());
		this.add(pName);
		this.add(Box.createHorizontalGlue());
		this.add(turns);
		this.add(Box.createHorizontalGlue());
		this.add(turn);
	}
}
